<!DOCTYPE html>
<title>Test that pausing the media element has an immediate effect on the clock.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var timeAfterPause;
    var video = document.querySelector("video");
    video.src = "content/test.ogv";
    video.oncanplay = t.step_func(function() {
        video.play();
    });

    video.onplaying = t.step_func(function() {
        video.ontimeupdate = t.step_func(function() {
            assert_greater_than(video.currentTime, 0);
            video.ontimeupdate = null;
            video.pause();
            timeAfterPause = video.currentTime;
        });
    });

    video.onpause = t.step_func_done(function() {
        assert_equals(video.currentTime, timeAfterPause);
        assert_equals(video.played.end(0), timeAfterPause);
    });
});
</script>